<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<body>
<div th:fragment="list(canEdit)" class="media" th:each="info : ${pageInfo.list}">
    <!--头像-->
    <div class="media-left">
        <a th:href="@{/user/{id}(id=${info.user.id})}">
            <img class="media-object img-rounded user_avatar"
                 th:src="${info.user.avatarUrl} == null ? '' : ${info.user.avatarUrl}">
        </a>
    </div>
    <!--内容-->
    <div class="media-body">
        <!--标题-->
        <h4 class="media-heading">
            <a th:href="@{'/question/'+${info.id}}" th:text="${info.title}" class="a-no-line"></a>
            <span class="to-right question-top" th:if="${!canEdit && session.user != null && session.user.id == 1}">
                <a th:if="${info.top == 0}" th:href="@{question/{oper}/{id}(id=${info.id}, oper=1)}">设为顶置</a>
                <a th:if="${info.top == 1}" th:href="@{question/{oper}/{id}(id=${info.id}, oper=0)}">取消顶置</a>
            </span>
        </h4>
        <span class="label label-danger" th:if="${info.top == 1}">顶置</span>
        <!--信息-->
        <span th:each="tag : ${info.tags.split(',')}">
            <span class="label label-primary" th:text="${tag}"></span>
        </span>
        <span class="question_info">
            [[${info.commentCount}]] 个评论 •
            [[${info.viewCount}]] 次浏览 •
            [[${#dates.format(info.gmtCreate, 'yyyy-MM-dd HH:mm:ss')}]]
        </span>
        <!--编辑操作-->
        <span th:if="${canEdit}" class="to-right">
            <a th:href="@{/publish/{id}(id=${info.id})}" class="question_text profile-canEdit"
               th:if="${session.user != null && info.creator==session.user.id}">
                    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                    编辑
            </a>
        </span>
        <hr>
    </div>
</div>
</body>
</html>